<?php 
use Workerman\Worker;
require_once './core/Autoloader.php';

$ws_socket = new Worker("websocket://192.168.18.59:8089");

$ws_socket->count=4;
// static $curnum=1;
class testarray{
	public static $connections = array();
}

$ws_socket->onConnect=function($connection){
	testarray::$connections[]=$connection;
	// $curnum++;
};

$ws_socket->onMessage=function($connection,$data)
{
	$arr=testarray::$connections;
	foreach ($arr as $value) {
		$value->send($data);
	}
};

Worker::runall();

?>